package com.cxm.report.model.data;

import com.cxm.report.model.IReport.Type;
import lombok.Data;

import java.util.List;

/**
 * @author scl
 * @date 2018年7月3日 上午10:10:03
 * @version 1.0
 * @description  报告
 */
@Data
public class Report {
	private Type type;
	private String date;
	private Object total;

	private Object details;

	public Report() {
	}

	public Report(Object total, Object details) {
		this.total = total;
		setDetails(details);
	}

	public void setDetails(Object details) {
		this.details = details;
		if ( details instanceof  List<?>){
            List<?> list = (List<?>) details;
            if (list != null && !list.isEmpty()){
                Object o = list.get(0);
                if (o instanceof  ReportDetail){
                    ReportDetail reportDetail = (ReportDetail) o;
                    if (reportDetail instanceof BrandReport){
                        setType(Type.BRAND);
                    }
                }
            }
        }

	}

    public void setType(Type type) {
        this.type = type;
    }

}
